Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Java Mail Interview Questions and Answers

Question: What is Session in JavaMail api?
Answer: Session is the top-level entry class representing mail session. It uses java.util.Properties object to get information about mail server, username, password etc. This class has a private constructor and you can get session objects through getInstance() and getDefaultInstance() methods. getDefaultInstance() method provides default Session object which takes Properties and Authenticator objects as arguments.

Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);


Or create a unique session by getInstance() method…

Properties props = new Properties();
Session session = Session.getInstance(props, null);
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook